<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>缤格</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/swiper.min.css"/>
    <!--<link rel="stylesheet" type="text/css" href="../../script/imgPreview/baguetteBox.css"/>-->
    <link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/binge.css"/>
    <script type="text/javascript" src="../../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../script/swiper.min.js"></script>
    <!--<script type="text/javascript" src="../../script/imgPreview/baguetteBox.js"></script>-->
    <!--<script type="text/javascript" src="../../script/imgPreview/highlight.min.js"></script>-->
    <script type="text/javascript" src="../../script/mobile.js"></script>
    <script type="text/javascript">
        window['adaptive'].desinWidth = 750;
        window['adaptive'].baseFont = 28;
        window['adaptive'].maxWidth = 750;
        window['adaptive'].init();
    </script>
</head>

<body>
<!-- header -->
<div id="header" style="height: 0.9rem; background: #fff; position: fixed; top: 0;left: 0; width: 100%; z-index: 99">
    <div class="header">
        <div class="head-back">
            <a href="javascript:void(0);" tapmode onclick="comeBack()" class="back-btn"></a>
        </div>
        <div class="head-title">
            <h6>投票详情</h6>
        </div>
        <div class="head-action">
            <!-- <a href="javascript:void(0);" tapmode onclick="openModel()" class="action-btn"></a> -->
        </div>
    </div>
</div>
<!-- header end -->
<div class="mescroll" id="mescroll" style="padding-top: 1.6rem;">
    <div class="detail-section">
        <div class="detail-title mb25">
            <div class="common-user-detail">
                <div class="user-info" tapmode onclick="personl_index('../activity/person_index')">
                    <div class="userRelative"><div class="user-icon bg-cover" id="icon" style="background-image: url(); width: 0.8rem; height: 0.8rem;"></div><span class="vip"></span></div>
                    <div class="info">
                        <div class="name">
                            <h6 id="name" style="padding-top: 0;"></h6>
                            <dl class="badge-list" id="badge" tapmode onclick="toBadgePage(event)">
                                <!--<dd class="icon"><img src="../../icon/icon-hz01.png" alt=""></dd>
                                <dd class="icon"><img src="../../icon/icon-hz02.png" alt=""></dd>
                                <dd class="icon"><img src="../../icon/icon-hz03.png" alt=""></dd>
                                <dd class="icon"><img src="../../icon/icon-hz04.png" alt=""></dd>
                                <dd class="icon"><img src="../../icon/icon-hz05.png" alt=""></dd>-->
                            </dl>
                        </div>
                        <div class="time" style="display: flex;"><span id="time"></span>
                            <div class="detail-hot ml20" id="hot">0</div>
                        </div>
                    </div>
                </div>
                <div class="follow" id="follow" tapmode onclick="followAction(this)">
                    <span class="no-follow">关注</span>
                    <span class="followed">已关注</span>
                </div>
            </div>
        </div>
        <div class="detail">
            <div class="indexContent">
                <div class="index-news">
                    <ul id="voteDetail">
                        <!--<li style="padding-top: 0;"><div class="video-detail"> <h6 tapmode class="news-title multiline-ellipsis_3"><span class="status being">进行中</span>经济学的作用大吗？</h6><div class="voteView"><ul class="choose radioChoose" data-max="1" data-min="1"><li data-id="16"><p class="multiline-ellipsis_3">大</p></li><li data-id="17"><p class="multiline-ellipsis_3">不大</p></li><li data-id="18"><p class="multiline-ellipsis_3">不知道</p></li></ul><ul class="voteResult dn"></ul><div class="vote-note"><p>单选</p><p>2020/03/28 00:00截止</p></div> <div class="vote-action"><div class="vote-btn btn" tapmode onclick="actionVote(2,7,this)">投票</div></div> </div> </div></li>-->
                    </ul>
                </div>
            </div>
        </div>

        <div class="detail-label"><span id="label" tapmode onclick="toCircle()"></span></div>
        <!-- <div class="share-view" style="display:none;">
            <div class="share-section">
                分享到
                <ul>
                    <li class="icon icon-wx" tapmode onclick="shareWx()"></li>
                    <li class="icon icon-wxq" tapmode onclick="shareWxq()"></li>
                    <li class="icon icon-qq" tapmode onclick="shareQq()"></li>
                    <li class="icon icon-qzone" tapmode onclick="shareQzone()"></li>
                    <li class="icon icon-wb" tapmode onclick="shareWb()"></li>
                </ul>
            </div>
        </div> -->
    </div>

    <div class="comment-section">
        <div class="comment-kinds">
            <ul>
                <li tapmode onclick="tabComment(1,this)" class="on"><span>评论</span><em class="mt10 ml5"
                                                                                       id="plNum">0</em></li>
                <li tapmode onclick="tabComment(2,this)"><span>喜欢</span> <em class="mt10 ml5" id="loveNum">0</em></li>
            </ul>
            <div class="screen-btn" tapmode onclick="screen(this)">按热度</div>
        </div>
        <div class="comment-area">
            <div class="comment-list area">
                <ul id="commentHtml">

                </ul>
                <div class="comment-input">
                    <div class="input-box">
                        <input type="text" id="inputContent" readonly data-pid="" placeholder="写评论...">
                        <!--<button class="send-btn" tapmode onclick="comment_add()">确定</button>-->
                    </div>
                    <div class="comment-count">
                        <div class="count-li collect" id="collect" tapmode onclick="collect(this)">0</div>
                        <div class="count-li love" id="love" tapmode onclick="clickFabulous('',7,'',event)">0</div>
                        <div class="count-li msg" id="msg" tapmode onclick="toAllList()">0</div>
                    </div>
                </div>


            </div>
            <div class="love-list area" style="display: none;">
                <ul id="sign_list">
                    <!--<li>
                        <div class="common-user-detail">
                            <div class="user-info">
                                <div class="user-icon bg-cover"
                                     style="background-image: url('../../image/img-tx.png');"></div>
                                <div class="info">
                                    <div class="name">
                                        <h6>后来熟悉</h6>
                                        <dl class="badge-list">
                                            <dd class="icon"><img src="../../icon/icon-hz01.png" alt=""></dd>
                                            <dd class="icon"><img src="../../icon/icon-hz02.png" alt=""></dd>
                                            <dd class="icon"><img src="../../icon/icon-hz03.png" alt=""></dd>
                                            <dd class="icon"><img src="../../icon/icon-hz04.png" alt=""></dd>
                                            <dd class="icon"><img src="../../icon/icon-hz05.png" alt=""></dd>
                                        </dl>
                                    </div>
                                    <span class="time single-ellipsis">无拘无束，自由自在自由自在自由自在自由自在自由自在自由自在</span>
                                </div>
                            </div>
                        </div>
                    </li>-->

                </ul>
            </div>
        </div>
    </div>
</div>

<div class="edit-model">
    <div class="edit-input">
        <div class="message-flex">
            <div class="message-box" id="message">
                <div class="message" id="article" contenteditable="true"></div>
            </div>
            <div class="message-img" style="display: none;" id="msgImg">
                <img src="" alt="">
                <span class="delete dn" tapmode onclick="removePic(this,event)"></span>
            </div>
        </div>

        <div class="But">
            <div class="but-list">
                <a href="javascript:void(0);" tapmode onclick="upload()" class="imgBut"></a>
                <a href="javascript:void(0);" tapmode onclick="showVideo()" class="videoBut"></a>
                <a href="javascript:void(0);" tapmode onclick="toAiteList()" class="aiTeBut"></a>
            </div>
            <span class="submit" tapmode onclick="comment_add()">确定</span>
        </div>
    </div>
</div>


<!-- 右上角操作 -->
<div class="action-model model" tapmode onclick="closeModel()">
    <div class="action-view" tapmode onclick="stopModel(event)">
        <h6 class="shareTitle">分享</h6>
        <a href="javascript:void(0);" tapmode onclick="closeModel(event)" class="model-close"></a>
        <div class="model-detail">
            <ul>
                <li tapmode onclick="shareWx(event)" class="threeShare">
                    <div class="share-icon icon1"></div>
                    <p>微信</p>
                </li>
                <li tapmode onclick="shareWxq(event)" class="threeShare">
                    <div class="share-icon icon2"></div>
                    <p>朋友圈</p>
                </li>
                <li tapmode onclick="shareQq(event)" class="threeShare">
                    <div class="share-icon icon3"></div>
                    <p>QQ</p>
                </li>
                <li tapmode onclick="shareQzone(event)" class="threeShare">
                    <div class="share-icon icon4"></div>
                    <p>QQ空间</p>
                </li>
                <li tapmode onclick="shareWb(event)" class="threeShare">
                    <div class="share-icon icon5"></div>
                    <p>微博</p>
                </li>
                <li tapmode class="copy" onclick="copyLink()">
                    <div class="share-icon icon-copy"></div>
                    <p>复制链接</p>
                </li>
                <li tapmode onclick="reportBtn(event)">
                    <div class="share-icon icon-report"></div>
                    <p>举报</p>
                </li>
            </ul>
        </div>
        <!--<div class="shade-user">-->
        <!--<a href="javascript:void(0);" class="shade-btn"><span>屏蔽此人</span></a>-->
        <!--</div>-->
    </div>
</div>
<!-- 右上角操作 end -->

<!--评论通用-->
<div class="photoViewerCommon">
    <div class="swiper-container photoViewer-common">
        <ul class="swiper-wrapper">
            <!--<li class="swiper-slide"><img src="../../image/banner01.png" alt=""></li>-->
            <li class="swiper-slide" onclick="closeViewCommon()"><img onclick="showViewCommon(event)" id="currentPic" class="swiper-lazy" src="" alt=""><div class="swiper-lazy-preloader"></div></li>
        </ul>
        <div class="photoViewer-bottom">
            <div onclick="closeViewCommon()" class="closeViewer"></div>
            <div class="swiper-pagination"></div>
            <div onclick="downloadPicCommon(event)" class="download"></div>
        </div>
    </div>
</div>
</body>

</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<link rel="stylesheet" type="text/css" href="../../css/zy.media.min.css"/>
<script type="text/javascript" src="../../script/zy.media.min.js"></script>
<link rel="stylesheet" type="text/css" href="../../css/mescroll.min.css"/>
<script type="text/javascript" src="../../script/mescroll.min.js"></script>
<script type="text/javascript" src="../../script/clipboard.min.js"></script>
<script type="text/javascript" src="../../script/detailSwiper.js"></script>
<script type="text/javascript" src="../../script/comment.js"></script>

<script type="text/javascript">
    var vote_id = '';//帖子id
    var circle_id = '';//圈子id
    var member_id = '';//用户id
    var stype = 1;//类型：1显示评论 2显示喜欢
    var hot = 1;//排序：1时间排序 2热度排序
    var page = 1;
    var pullUp = true;
    var _model = $(".model");
    var video_id = 0;
    var msgImg_id = 0;

    var shareTitle = '';//分享title
    var shareInfo = '发现精彩大学生活，更多内容，尽在大学情报局～（分享自大学情报局 App）';//分享info
    var shareImg = 'widget://icon/logo.png';//分享图片

    apiready = function () {

        setFixStatusBar(); //设置状态栏
        keybackListener()
        vote_id = api.pageParam.vote_id;
        // vote_id = 9;

        getVoteDetail()

        SystemCheckVersion()


        api.addEventListener({
            name: 'aite'
        }, function(ret, err) {
            console.log(JSON.stringify(ret.value));
            var mid = ret.value.id;
            var mname = ret.value.name;
            var mUrl = '../activity/person_index';
            var m_id = {member_id: mid}
            var word = '<span style="display: inline; color: #ff7777;" class="aite" data-id="'+mid+'" onclick=\'commonUrl("'+mUrl+'",'+jsonChange(m_id)+')\'>@'+mname+'</span>　';
            // $("#article").append(word);
            checkSystemType(function () {
                $("#article").append(word);
            },function () {
                _insertimg(word)
            });
        });

    };


    function toAllList() {
        //type: 1新闻，2帖子，3活动贴，4赛事，5战况，6投票，7广场评星
        getAllList(6,vote_id)
    }


    //二级评论获取评论目标
    var _input = $("#inputContent");
    var _editModel = $(".edit-model");
    var _article = $("#article");
    _input.click(function () {
        _editModel.show();
        var html = _article.html()
        _article.html('').focus();
    });

    function reply(id, name) {
        var pid = id;
        _input.attr('placeholder', '回复：' + name);
        _input.attr('data-pid', pid);
        _editModel.show();
        _article.focus();
        console.log(pid)
    }

    /*_article.blur(function () {
        if (_article.html() == '' || msgImg_id != 0) {
            _input.val('');
            _input.attr('placeholder', '写评论...');
            _input.attr('data-pid', '');
        }
    });*/


    //关闭评论框
    _editModel.on('click', function () {
        _input.val('');
        _input.attr('placeholder', '写评论...');
        _input.attr('data-pid', '');
        _editModel.hide()
    });
    //阻止事件冒泡 关闭评论框
    _editModel.on('click', '.edit-input', function (event) {
        event.stopPropagation()
        /*_article.focus();*/
    });

    //评论
    var addStatus = true;
    function comment_add() {
        var pid = '', type = 6;
        if (_input.attr('data-pid')) {
            pid = _input.attr('data-pid');
            type = 0;
        }
        var uidsArr = [];
        $("#article .aite").each(function () {
            var _this = $(this);
            var _thisId = _this.attr('data-id');
            uidsArr.push(_thisId);
        });
        var param = {
            token: $api.getStorage('token'),
            type: type,//类型：1新闻 2帖子 3活动 0回复 4赛事，5战况，6投票，7广场
            key_id: vote_id,
            content: _article.html(),
            pid: pid,//当type为0的时候必须传入,二级回复，就是评论的id
            icon: msgImg_id,
            void_id: video_id,
            uids: uidsArr.toString()
        }
        if (!isDefine(param.content)&&!isDefine(param.icon)&&!isDefine(param.void_id)) {
            pop.notice('请发表你的评论内容');
            return false;
        }
        if(addStatus == false){
            return;
        }
        console.log(jsonChange(param));
        // return;
        pop.loading();
        getAjax(Interface.comment_add, param, function (res) {
            addStatus = false;

            _editModel.hide();
            _article.html('');
            _input.attr('placeholder', '写评论...');
            _input.attr('data-pid', '');

            $("#msgImg").siblings('img').attr('src','').removeAttr('data-id');
            $("#msgImg").hide();
            msgImg_id = 0;
            video_id = 0;

            pop.notice(res.msg)
            pop.close();
            setTimeout(function () {
                page = 1;
                getEvaluateDetail()
                addStatus = true;
            }, 1500)
        }, function (error) {
            pop.notice(error.msg)
            pop.close();
        })
        _article.blur();//失去焦点
    }



    //举报
    function reportBtn(event) {
        event.stopPropagation()
        var param = {
            type: 3,
            pid: vote_id,
        }
        commonUrl('../member/jubao', param);
        closeModel()
    }

    //跳转对应圈子
    function toCircle() {
        var param = {
            circle_id: circle_id
        }
        commonUrl('../circle/circle_index', param);
    }

    /*下拉刷新的回调 */
    function downCallback() {
        stype = 1;
        hot = 1;
        page = 1;
        getVoteDetail()

        //mescroll.endErr();
    }

    //创建MeScroll对象
    var mescroll = new MeScroll("mescroll", {
        down: {
            auto: false, //是否在初始化完毕之后自动执行下拉回调callback; 默认true
            callback: downCallback //下拉刷新的回调
        },
        up: {
            auto: false, //是否在初始化时以上拉加载的方式自动加载第一页数据; 默认false
            isBounce: false, //此处禁止ios回弹,解析(务必认真阅读,特别是最后一点): http://www.mescroll.com/qa.html#q10
            callback: upCallback, //上拉回调,此处可简写; 相当于 callback: function (page) { upCallback(page); }
            /*toTop:{ //配置回到顶部按钮
                src : "../res/img/mescroll-totop.png", //默认滚动到1000px显示,可配置offset修改
                //offset : 1000
            }*/
        }
    });

    /*上拉加载的回调 */
    function upCallback() {
        if (pullUp == true) {
            getEvaluateDetail()
        } else {
            mescroll.endErr();
        }
    }


    //切换
    function tabComment(tab, that) {
        $(that).addClass('on').siblings('li').removeClass('on');
        if (tab == 1) {
            $('.love-list').hide().siblings(".comment-list").show();
            $(".screen-btn").show();
            stype = 1;
            page = 1;
            hot = 1;
            getEvaluateDetail()
        } else {
            $(".comment-list").hide().siblings('.love-list').show();
            $(".screen-btn").hide();
            stype = 2;
            page = 1;
            hot = 1;
            getEvaluateDetail()
        }
    }

    //排序
    function screen(that) {
        var _this = $(that);
        if (_this.html() == '按热度') {
            $(".screen-btn").html('按时间')
            hot = 2;
        } else {
            $(".screen-btn").html('按热度');
            hot = 1;
        }
        page = 1;
        getEvaluateDetail();
    }

    //
    // //投票功能 - 单选
    // $(".indexContent").on('click',".radioChoose li",function(){
    //     var _this = $(this);
    //     _this.addClass('on').siblings('li').removeClass('on');
    // })
    //
    //
    // //投票功能 - 多选
    // $(".indexContent").on('click',".checkChoose li",function(){
    //     var _this = $(this);
    //     var _thisP = _this.parents('.checkChoose');
    //     var _max = _thisP.attr('data-max');
    //     var _min = _thisP.attr('data-min');
    //     var _num = _thisP.find('.on').length;
    //     console.log(_num)
    //     if(_this.hasClass('on')){
    //         if(_num >= _min){
    //             _this.removeClass('on');
    //         }else {
    //             pop.notice('最少选择'+_min+'项')
    //         }
    //         _this.removeClass('on');
    //     }else {
    //         if(_num < _max){
    //             _this.addClass('on');
    //         }else {
    //             pop.notice('最多选择'+_max+'项')
    //         }
    //     }
    // })



    //投票详情
    function getVoteDetail() {

        var param = {
            token: $api.getStorage('token'),
            vote_id: vote_id,
        }
        pop.loading()
        getAjax(Interface.vote_details, param, function (res) {
            console.log(jsonChange(res))
            var data = res.data;
            if (isDefine(data)) {
                if (isDefine(data.member_id)) {
                    member_id = data.member_id;
                }

                shareTitle = data.title;

                circle_id = data.circle_id;
                title = data.title;

                $("#icon").css({background: 'url(' + ajaxUrl + data.member.icon_path + ')'});
                $("#name").html(data.member.name);
                $("#title").html(data.title);
                $("#content").html(data.content);
                // baguetteBox.run('.detail');

                $("#time").html(data.date);
                $("#hot").html(data.hot_number);

                //标签
                if (isDefine(data.circle_title)) {
                    $("#label").html('#'+data.circle_title+'#');
                }

                //是否关注
                if (data.member_follow == 0) {
                    $("#follow").removeClass('on');
                } else {
                    $("#follow").addClass('on');
                }
                //是否为自己
                if (isDefine(data.self_status)) {
                    if (data.self_status == 1) {
                        $("#follow").hide()
                    } else {
                        $("#follow").show()
                    }
                }

                //分享封面图
                if (isDefine(data.icon_path)) {
                    shareImg = ajaxUrl + data.icon_path[0];
                }


                //徽章列表
                if (isDefine(data.member.badge_path)) {
                    var imgUrls = '';
                    for (var i = 0; i < data.member.badge_path.length; i++) {
                        imgUrls += '<dd class="icon"><img src="' + ajaxUrl + data.member.badge_path[i] + '" alt=""></dd>'
                    }
                    $("#badge").html(imgUrls)
                }


                //收藏
                $("#collect").html(data.collection_number)
                if (data.collect_status == 1) {
                    $("#collect").addClass('on')
                } else {
                    $("#collect").removeClass('on')
                }

                //点赞
                $("#love").html(data.fabulous_number)
                $("#loveNum").html(data.fabulous_number)
                if (data.fabulous_status == 1) {
                    $("#love").addClass('on')
                } else {
                    $("#love").removeClass('on')
                }

                //评论量
                $("#plNum").html(data.comment_number)
                $("#msg").html(data.comment_number)


                var html = vote_detail(data,2);
                console.log(html)

                $("#voteDetail").html(html);

            }
            getEvaluateDetail();
            mescroll.endErr()
            pop.close();
        }, function (error) {
            pop.notice(error.msg)
            pop.close();
            mescroll.endErr()
        })
    }


    //投票详情
    function getEvaluateDetail() {

        var param = {
            token: $api.getStorage('token'),
            vote_id: vote_id,
            stype: stype,//类型：1显示评论 2显示喜欢
            hot: hot,//排序：1时间排序 2热度排序
            page: page,
        }
        pop.loading()
        getAjax(Interface.get_vote_footer, param, function (res) {
            console.log(jsonChange(res))
            var data = res.data;
            var comment = res.data.list.comment;
            if (stype == 1) {
                var commentHtml = '';
                if (isDefine(comment)) {
                    commentHtml = getEvaluteList(comment,vote_id)
                    if (page == 1) {
                        $("#commentHtml").html(commentHtml)
                    } else {
                        $("#commentHtml").append(commentHtml)
                    }
                    console.log(commentHtml)
                    page++;
                    pullUp = true;
                    SystemCheckVersion()
                } else {

                    if (page == 1) {
                        $("#commentHtml").html(noData)
                    }
                    pullUp = false;
                }
            } else {
                var list = res.data.list;
                var listHtml = '';
                if (isDefine(list)) {
                    for (var i = 0; i < list.length; i++) {
                        console.log(1)
                        var autograph = '';
                        if (list[i].autograph == '' || list[i].autograph == 0) {
                            autograph = commonNote;
                        } else {
                            autograph = list[i].autograph
                        }

                        var listBadge = '';
                        if (isDefine(list[i].badge_path)) {
                            for (var a = 0; a < list[i].badge_path.length; a++) {
                                listBadge += '<dd class="icon"><img src="' + ajaxUrl + list[i].badge_path[a] + '" alt=""></dd>';
                            }
                        }


                        var userHtml = '';
                        userHtml = '<div class="user-info">' +
                            '            <div class="userRelative"><div class="user-icon bg-cover" style="background-image: url(' + ajaxUrl + list[i].icon_path + ');"></div><span class="vip"></span></div>' +
                            '                            <div class="info">' +
                            '                                <div class="name">' +
                            '                                    <h6>' + list[i].name + '</h6>' +
                            '                                    <dl class="badge-list" tapmode onclick="toBadgePage(event)">' + listBadge + '</dl>' +
                            '                                </div>' +
                            '                                <p class="sign-info single-ellipsis">' + autograph + '</p>' +
                            // '                                <span class="time">3分钟前</span>' +
                            '                            </div>' +
                            '                        </div>';


                        var param = '', mUrl = '';
                        var user_id = $api.getStorage('userInfo').id;
                        if (list[i].id == user_id) {
                            mUrl = '../member/member';
                        } else {
                            mUrl = '../activity/person_index';
                            param = {member_id: list[i].id}
                        }

                        listHtml += '<li><div class="common-user-detail" tapmode onclick=\'commonUrl("' + mUrl + '",' + jsonChange(param) + ')\'>' + userHtml + '</div></li>';

                    }
                    $("#sign_list").html(listHtml)
                } else {
                    $("#sign_list").html(noData)
                }


            }

            mescroll.endErr()
            pop.close();
        }, function (error) {
            pop.notice(error.msg)
            pop.close();
            mescroll.endErr()
        })
    }

    //添加收藏、取消收藏
    var toast = true

    function collect(that) {
        var _this = $(that);
        var pid = vote_id;
        var type = 7;
        if (toast) {
            if (_this.hasClass('on')) {
                collection_cancel(type, pid, function (res) {
                    pop.notice('取消收藏')
                    _this.removeClass('on').html(parseInt(_this.html()) - 1)
                    pop.close()
                })
            } else {
                collection(type, pid, function (res) {
                    pop.notice('收藏成功')
                    _this.addClass('on').html(parseInt(_this.html()) + 1)
                    pop.close()
                })
            }
            toast = false;
            setTimeout(function () {
                toast = true;
            }, 1000)
        }

    }


    function personl_index(path) {
        var param = {"member_id": member_id};
        user_id = $api.getStorage('userInfo').id;
        if(member_id == user_id){
          return false;
        }
        commonUrl(path, param)
    }

    //关注、取消关注
    function followAction(that) {
        var _this = $(that);
        var f_stype = '';
        if (_this.hasClass('on')) {
            f_stype = 2;
        } else {
            f_stype = 1;
        }
        var type = 1;//类型：1会员 2圈子
        follow(f_stype, type, member_id, function (res) {
            if (f_stype == 1) {
                pop.notice('关注成功')
                $(that).addClass('on')
            } else {
                pop.notice('已取消关注')
                $(that).removeClass('on')
            }
            api.sendEvent({
                name: 'invitation',
                extra: {}
            });
        })
    }


    //点赞或者取消点赞 类型type：1新闻 2帖子 3活动 4评论
    function clickFabulous(f_stype, type, pid,event) {
        event.stopPropagation()
        //活动点赞
        if (type == 7) {
            pid = vote_id;
            if ($('#love').hasClass('on')) {
                f_stype = 2
            } else {
                f_stype = 1
            }
        }

        fabulous(f_stype, type, pid, function (res) {
            if (f_stype == 1) {
                pop.notice('点赞成功')
            } else {
                pop.notice('取消点赞')
            }
            setTimeout(function () {
                page = 1;
                getVoteDetail()
            }, 500)
        })
    }


    //开启弹窗
    function openModel() {
        _model.addClass('showModel');
        setTimeout(function () {
            _model.find('.action-view').addClass('showView');
        }, 10)
    }

    //阻止事件冒泡
    function stopModel(event) {
        event.stopPropagation();
    }

    //关闭弹窗
    function closeModel(event) {
        if (event) {
            event.stopPropagation();
        }
        _model.find('.action-view').removeClass('showView');
        setTimeout(function () {
            _model.removeClass('showModel');
        }, 500)
    }


    function copyLink() {
        var text = ajaxUrl + '/api/share/news?type=2&id=' + vote_id;
        copy(text);
    }

    //scene:session（会话）timeline（朋友圈）favorite（收藏）
    //title:标题
    //thumb 图标
    //contentUrl 分享的地址

    //微信好友分享
    function shareWx() {
        var p = {
            apiKey: '',
            scene: 'session',
            title: shareTitle,
            thumb: 'widget://icon/logo.png',
            description:shareInfo,
            contentUrl: ajaxUrl + '/api/share/news?type=2&id=' + vote_id,
        };
        wxpyqFX(p);
    }

    //朋友圈
    function shareWxq() {
        var p = {
            apiKey: '',
            scene: 'timeline',
            title: shareTitle,
            thumb: 'widget://icon/logo22.png',
            description:shareInfo,
            contentUrl: ajaxUrl + '/api/share/news?type=2&id=' + vote_id,
        };
        wxpyqFX(p);
    }

    //qq好友
    function shareQq() {
        var p = {
            url: ajaxUrl + '/api/share/news?type=2&id=' + vote_id,
            title: shareTitle,
            description: shareInfo,
            imgUrl: shareImg,
            type: 'QFriend'
        }
        qqfx(p);
    }

    //qq空间
    function shareQzone() {
        var p = {
            url: ajaxUrl + '/api/share/news?type=2&id=' + vote_id,
            title: shareTitle,
            description: shareInfo,
            imgUrl: shareImg,
            type: 'QZone'
        }
        qqfx(p);
    }

    //微博
    function shareWb() {
        var p = {
            apiKey: '',
            scene: 'session',
            title: shareTitle,
            description: shareInfo,
            thumb: 'widget://icon/logo22.png',
            contentUrl: ajaxUrl + '/api/share/news?type=2&id=' + vote_id,
        };
        weibo_authorize(p);
    }




</script>
